// pages/appeal/appeal.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    student:""
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getStudent(JSON.parse(options.student))
  },
  getStudent(student) {
    let that = this;
    console.log(student)
    that.setData({
      student : student
    })
  },
  formSubmit: function (e) {
    var that = this;
    var courseid = e.detail.value.couserid;
    var studentid = e.detail.value.userid;
    var remark = e.detail.value.mark;
    var status = 1;
    wx.request({
      url: 'http://localhost:8080/Examination_System_war/wxappeal/saveAppeal',
      data: {
        courseid,
        studentid,
        remark,
        status
      },
      header: { 'content-type': '	application/json;charset=UTF-8' },
      method: 'POST',
      dataType: 'json',
      responseType: 'text',
      success: (result) => {
        wx.showToast({
          title: '成功',
          icon: 'none',
          image: '',
          duration: 1500,
          mask: false,
          success: (result) => {
        wx.navigateBack({
        });
          },
          fail: () => {},
          complete: () => {}
        });
      },
      fail: () => { },
      complete: () => { }
    });
  
  
  }
})